package com;

import java.util.Scanner;

public class LuckyPage {
	/**
	 * 判断是否已登录
	 */
	public static void isLogin(){
		System.out.println("请登陆,再抽奖!是否已注册y/n");
		Scanner input_1 = new Scanner(System.in);
		String reg = input_1.nextLine();
		if (reg.equals("y")) {
			// 调用登录类
			LoginPage.login();
		} else if(reg.equals("n")){
			// 没有注册调用注册类
			RegPage.reg();
		}
	}

	/**
	 * 抽奖算法
	 * @param id
	 */
	public static void goDraw() {
		System.out.println("**********开始抽奖**********");
		System.out.println("请输入你的会员卡号：");
		
		Scanner input_card = new Scanner(System.in);
		int number = input_card.nextInt();
		// 生成5个4位随机数字，并保存在数组中
		int[] luckyNumbers = new int[5];
		int i = 0;
		System.out.print("\n本日的幸运数字为：");
		for (i = 0; i < luckyNumbers.length; i++) {
			luckyNumbers[i] = (int) (Math.random() * (RegPage.max - RegPage.min)) + RegPage.min;
			System.out.print(luckyNumbers[i] + ",");
			if (RegPage.cardNumber == luckyNumbers[i]) {
				System.out.println("恭喜中奖！");
				break;
			}
		}

		if (i == luckyNumbers.length) {
			System.out.println("\n很遗憾，你不是今日的幸运会员");
		}
	}
}
